package de.koller.gravity.mech.particle.environment;

import de.koller.gravity.mech.particle.Particle;
import de.koller.gravity.mech.particle.ParticleEngine;

public class ParticleDestroyer implements IParticleEnvironment {

	public long lifetime = 1000;

	public ParticleDestroyer( long lifetime ) {
		this.lifetime = lifetime;
	}
	
	@Override
	public void stepParticle( Particle p, ParticleEngine engine ) {
		if( engine.getEngineStep() - p.creationTime > lifetime )
			engine.particles.remove( p );
	}
	
}
